/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package eu.easyedu.dictionary.explorer.nodes;

import eu.easyedu.dictionary.api.model.Dictionary;
import eu.easyedu.dictionary.explorer.DictionaryList;
import java.util.Collections;
import java.util.List;
import org.openide.nodes.ChildFactory;
import org.openide.nodes.Node;

/**
 *
 * @author hlavki
 */
public class DictionaryFactory extends ChildFactory<Dictionary> {

    @Override
    protected boolean createKeys(List<Dictionary> toPopulate) {
        toPopulate.addAll(DictionaryList.getDefault().getDictionaries());
        Collections.sort(toPopulate);
        return true;
    }

    @Override
    protected Node createNodeForKey(Dictionary key) {
        return new DictionaryNode(key);
    }
}
